<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="DocumentoCreateDlg" widgetVar="DocumentoCreateDialog" modal="true" resizable="false" appendToBody="true" header="#{bundle.CreateDocumentoTitle}">

            <h:form id="DocumentoCreateForm">

                <h:panelGroup id="display">
                    <p:panelGrid columns="2" rendered="#{documentoController.selected != null}">

                        <p:outputLabel value="#{bundle.CreateDocumentoLabel_id}" for="id" />
                        <p:inputText id="id" value="#{documentoController.selected.id}" title="#{bundle.CreateDocumentoTitle_id}" required="true" requiredMessage="#{bundle.CreateDocumentoRequiredMessage_id}"/>

                        <p:outputLabel value="#{bundle.CreateDocumentoLabel_codigo}" for="codigo" />
                        <p:inputText id="codigo" value="#{documentoController.selected.codigo}" title="#{bundle.CreateDocumentoTitle_codigo}" required="true" requiredMessage="#{bundle.CreateDocumentoRequiredMessage_codigo}"/>

                        <p:outputLabel value="#{bundle.CreateDocumentoLabel_descripcion}" for="descripcion" />
                        <p:inputText id="descripcion" value="#{documentoController.selected.descripcion}" title="#{bundle.CreateDocumentoTitle_descripcion}" required="true" requiredMessage="#{bundle.CreateDocumentoRequiredMessage_descripcion}"/>

                        <p:outputLabel value="#{bundle.CreateDocumentoLabel_fechaExpedicion}" for="fechaExpedicion" />
                        <p:calendar id="fechaExpedicion" pattern="MM/dd/yyyy HH:mm:ss" value="#{documentoController.selected.fechaExpedicion}" title="#{bundle.EditDocumentoTitle_fechaExpedicion}"  showOn="button"/>

                        <p:outputLabel value="#{bundle.CreateDocumentoLabel_fechaExpiracion}" for="fechaExpiracion" />
                        <p:calendar id="fechaExpiracion" pattern="MM/dd/yyyy HH:mm:ss" value="#{documentoController.selected.fechaExpiracion}" title="#{bundle.EditDocumentoTitle_fechaExpiracion}"  showOn="button"/>

                        <p:outputLabel value="#{bundle.CreateDocumentoLabel_creationDate}" for="creationDate" />
                        <p:calendar id="creationDate" pattern="MM/dd/yyyy HH:mm:ss" value="#{documentoController.selected.creationDate}" title="#{bundle.EditDocumentoTitle_creationDate}" required="true" requiredMessage="#{bundle.EditDocumentoRequiredMessage_creationDate}" showOn="button"/>

                        <p:outputLabel value="#{bundle.CreateDocumentoLabel_createdBy}" for="createdBy" />
                        <p:inputText id="createdBy" value="#{documentoController.selected.createdBy}" title="#{bundle.CreateDocumentoTitle_createdBy}" required="true" requiredMessage="#{bundle.CreateDocumentoRequiredMessage_createdBy}"/>

                        <p:outputLabel value="#{bundle.CreateDocumentoLabel_lastUpdateDate}" for="lastUpdateDate" />
                        <p:calendar id="lastUpdateDate" pattern="MM/dd/yyyy HH:mm:ss" value="#{documentoController.selected.lastUpdateDate}" title="#{bundle.EditDocumentoTitle_lastUpdateDate}"  showOn="button"/>

                        <p:outputLabel value="#{bundle.CreateDocumentoLabel_lastUpdateBy}" for="lastUpdateBy" />
                        <p:inputText id="lastUpdateBy" value="#{documentoController.selected.lastUpdateBy}" title="#{bundle.CreateDocumentoTitle_lastUpdateBy}" required="true" requiredMessage="#{bundle.CreateDocumentoRequiredMessage_lastUpdateBy}"/>

                        <p:outputLabel value="#{bundle.CreateDocumentoLabel_socioList}" for="socioList" />
                        <p:selectManyMenu id="socioList" value="#{documentoController.selected.socioList}" >
                            <f:selectItems value="#{socioController.items}"
                                           var="socioListItem"
                                           itemValue="#{socioListItem}"
                                           itemLabel="#{socioListItem.id.toString()}"
                                           />
                            <f:converter binding="#{socioConverter}"/>
                        </p:selectManyMenu>

                        <p:outputLabel value="#{bundle.CreateDocumentoLabel_motoristaList}" for="motoristaList" />
                        <p:selectManyMenu id="motoristaList" value="#{documentoController.selected.motoristaList}" >
                            <f:selectItems value="#{motoristaController.items}"
                                           var="motoristaListItem"
                                           itemValue="#{motoristaListItem}"
                                           itemLabel="#{motoristaListItem.id.toString()}"
                                           />
                            <f:converter binding="#{motoristaConverter}"/>
                        </p:selectManyMenu>

                        <p:outputLabel value="#{bundle.CreateDocumentoLabel_tipoDocumentoId}" for="tipoDocumentoId" />
                        <p:selectOneMenu id="tipoDocumentoId" value="#{documentoController.selected.tipoDocumentoId}" required="true" requiredMessage="#{bundle.EditDocumentoRequiredMessage_tipoDocumentoId}">
                            <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                            <f:selectItems value="#{tipoDocumentoController.items}"
                                           var="tipoDocumentoIdItem"
                                           itemValue="#{tipoDocumentoIdItem}"
                                           itemLabel="#{tipoDocumentoIdItem.descripcion.toString()}"
                                           />
                            <f:converter binding="#{tipoDocumentoConverter}"/>
                        </p:selectOneMenu>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{documentoController.saveNew}" value="#{bundle.Save}" update="display,:DocumentoListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,DocumentoCreateDialog);"/>
                    <p:commandButton value="#{bundle.Cancel}" onclick="DocumentoCreateDialog.hide()"/>
                </h:panelGroup>

            </h:form>

        </p:dialog>

    </ui:composition>

</html>
